package fhp.hlhj.giantfold.module

import com.lzy.okgo.model.HttpParams
import fhp.hlhj.giantfold.javaBean.GetSmsBean
import fhp.hlhj.giantfold.javaBean.PhoneRegisBean
import fhp.hlhj.giantfold.network.UrlApis

/**
 * author: FHP
 * data: on 2018\1\10 0010 9:35
 * E-Mail: 103945089@qq.com
 */
class PhoneRegisModule {
    interface PhoneOverListener{
        fun showLoading()
        fun over(getSmsBean: GetSmsBean)
        fun overRegis(phoneRegisBean: PhoneRegisBean)
    }

    fun getSms(params: HttpParams,phoneOverListener: PhoneOverListener){
        UrlApis.getSMSCode(params)
                .doOnSubscribe {
                    phoneOverListener.showLoading()
                }
                .subscribe {
                    data->
                    phoneOverListener.over(data)
                }
    }
    fun phoneRegis(params: HttpParams,phoneOverListener: PhoneOverListener){
        UrlApis.phoneRegis(params)
                .doOnSubscribe {
                    phoneOverListener.showLoading()
                }
                .subscribe {
                    data->
                    phoneOverListener.overRegis(data)
                }
    }
}